/************************************************************************
Author:			Trey Turley, Thomas Lee, Mark Willis

Filename:		App_OnDraw.cpp

Description:	This file contains functions for the class app(?).
				These functions are used to do things like display the
				opening screen followed by the game map and to draw
				the players(Trails) on the screen.

Date Modified:	8/4/10
				-	Added more functions

				8/3/10
				-	File created
*************************************************************************/


#include "Draw.h"
#include <iostream>



//Currently this displays a title screen and then pauses for 5 seconds.
//It will then draw the game map and some basic
//directions are printed below the screen.


/************************************************************************
 Name:			OnDraw()

 Description:	Currently this displays a title screen and
				then pauses for 5 seconds.
				It will then draw the game map and some basic
				directions are printed below the screen.

 Input:
 (None)

 Output:
 (None)
*************************************************************************/
	App::OnDraw()
	{
			//Main Title
			Plotter Title;
			Title.setColor(red);
			Title.move(40,5);
			cout<<"TRON";
			Title.move(40,6);
			cout<<"By:";
			Title.move(40,7);
			cout<<"Thomas Lee";
			Title.move(40,8);
			cout<<"Mark Willis";
			Title.move(40,9);
			cout<<"Trey Turley";

		//Pause on opening screen
			Sleep(5000);

		//clear it!
			Title.clear();

		//Fill in map
			Plotter map;
			map.setColor(white);
			
			for(int a=0;a<80;a++)
			{
				for(int b=0;b<40;b++)
				{
					map.plot(a,b,SQUARE);
				}
			}

		//Move cursor to bottom of map.
			map.move(0,41);

		//Print some directions under the map
			Plotter Directions;
			Directions.setColor(white);
			cout<<"Directions for Tron: The goal is to trap your opponent."<<endl;
			cout<<"Try not to run into the walls or your opponent's trail."<<endl;

	
	}

/************************************************************************
 Name:			DrawTrail(int x, int y, ink color)

 Description:	Used to plot a player's trail. does not have to be player
				specific.  the (X,Y) coords and the 
				color of the trail.  

 Input:

 int x		-	The x coordinate on the (X,Y) grid

 int y		-	The Y coordinate on the (X,Y) grid

 ink color	-	The color of the trail. 
				Ex: red, blue, green...etc

 Output:
 (None)
*************************************************************************/
App::DrawTrail(int x, int y, ink color)
{
	Plotter Trails;
	Trails.plotTrail(x,y,color);	
}

/************************************************************************
 Name:			GameOver(int p);

 Description:	Used to display who Won the round/game. The result is
				displayed for four seconds and then everything
				is cleared from the screen.

 Input:

 int p		-	Shows which player won the round/game.
				1	-	Player One Won
				2	-	Player Two Won
				3	-	Tie Game
 Output:
 (None)
*************************************************************************/
App::GameOver(int p)
{
	Plotter cursor;
	cursor.move(20,43);	
	if(p==1)
	{
		cout<<"Player One Won The Round!";
		Sleep(4000);
	}
	else if(p==2)
	{
		cout<<"Player Two Won The Round!";
		Sleep(4000);
	}
	else if(p==3)
	{
		cout<<"Tie Game";
		Sleep(4000);
	}

	cursor.clear();
}
